﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using MaymuseMS.Models.ValueObject;

namespace MaymuseMS.Models {
    public class Depository {
        public int DepositoryId { get; set; }

        public virtual ProductValueObject ProductValueObject { get; set; }

        public double Total {
            get {
                if (DepositoryItems != null) {
                    return DepositoryItems.Sum(d => d.Count);
                }
                return 0;
            }
        }
        public double? SafetyCount { get; set; }

        [MaxLength(1000)]
        public string Remark { get; set; }

        public virtual IList<DepositoryItem> DepositoryItems { get; set; }
    }
}